package com.epfly.promo.activity.dao;

import com.epfly.promo.activity.entity.ActivityBargainFoodEntity;
import org.apache.ibatis.annotations.*;
import tk.mybatis.mapper.additional.insert.InsertListMapper;
import tk.mybatis.mapper.common.BaseMapper;

import java.util.List;

@Mapper
public interface ActivityBargainFoodMapper extends BaseMapper<ActivityBargainFoodEntity>, InsertListMapper<ActivityBargainFoodEntity> {


    @Delete(value = "delete from tbl_activity_bargain_food where activity_id = #{activityId} and del_flag = 0 ")
    int deleteByActivityId(@Param(value = "activityId") Long activityId);


    @ResultMap(value = "activityBargainFoodMapperBaseResultMap")
    @Select(value = "select relation_id, bargain_amount from tbl_activity_bargain_food where activity_id = #{activityId} and del_flag = 0  ")
    List<ActivityBargainFoodEntity> findByActivityId(@Param(value = "activityId") Long activityId);

    ActivityBargainFoodEntity existsByActivityIdAndFoodIdList(@Param(value = "activityId") Long activityId, @Param(value = "foodIdList") List<String> foodIdList);

    List<ActivityBargainFoodEntity> findByActivityIdAndFoodIdList(@Param(value = "activityId") Long activityId, @Param(value = "foodIdList") List<String> foodIdList);
}
